import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '售后时间',
    align:"center",
    dataIndex: 'afterSalesDate',
    customRender:({text}) =>{
      text = !text ? "" : (text.length > 10 ? text.substr(0,10) : text);
      return text;
    },
  },
  {
    title: '售后类型',
    align:"center",
    dataIndex: 'afterSalesType'
  },

   {
    title: '机型',
    align:"center",
    dataIndex: 'afterSalesModel'
   },

   {
    title: '售后者',
    align:"center",
    dataIndex: 'afterSalesId'
   },

   {
    title: '问题描述',
    align:"center",
    dataIndex: 'afterSalesIss'
   },

  {
    title: '问题照片',
    align:"center",
    dataIndex: 'afterSalesImg',
    customRender:render.renderImage,
  },
   {
    title: '解决方案',
    align:"center",
    dataIndex: 'afterSalesSolution',
   },

  {
    title: '方案文档',
    align:"center",
    dataIndex: 'afterSalesFile',
  },
  {
    title: '备注',
    align:"center",
    dataIndex: 'remarks'
  },
   {
    title: '订单ID',
    align:"center",
    dataIndex: 'afterSalesOrderId'
   },

   {
    title: '生产单ID',
    align:"center",
    dataIndex: 'afterSalesProId'
   },

];
//查询数据
export const searchFormSchema: FormSchema[] = [
    {
      label: "售后者",
      field: "afterSalesId",
      component: 'JInput',
    },
     {
      label: "售后时间",
      field: "afterSalesDate",
      component: 'RangePicker',
      componentProps: {
        valueType: 'Date',
      },
      //colProps: {span: 6},
	},
	{
      label: "售后类型",
      field: 'afterSalesType',
      component: 'Input',
      //colProps: {span: 6},
 	},
  {
    label: "问题描述",
    field: "afterSalesIss",
    component: 'JInput',
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '售后时间',
    field: 'afterSalesDate',
    component: 'DatePicker',
    componentProps: {
      valueFormat: 'YYYY-MM-DD'
    },
  },
  {
    label: '机型',
    field: 'afterSalesModel',
    component: 'Input',
  },
  {
    label: '售后者',
    field: 'afterSalesId',
    component: 'Input',
  },

  {
    label: '售后类型',
    field: 'afterSalesType',
    component: 'Input',
  },
  {
    label: '问题描述',
    field: 'afterSalesIss',
    component: 'Input',
  },
  {
    label: '问题照片',
    field: 'afterSalesImg',
    component: 'JImageUpload',
    componentProps:{
      fileMax: 0
    },
  },

  {
    label: '解决方案',
    field: 'afterSalesSolution',
    component: 'JEditor',
  },

  {
    label: '方案文档',
    field: 'afterSalesFile',
    component: 'JUpload',
    // componentProps:{
    // },
  },
  {
    label: '备注',
    field: 'remarks',
    component: 'Input',
  },

  {
    label: '订单ID',
    field: 'afterSalesOrderId',
    component: 'Input',
  },
  {
    label: '生产单ID',
    field: 'afterSalesProId',
    component: 'Input',
  },


	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  reserve1: {title: '预留1',order: 0,view: 'text', type: 'string',},
  reserve2: {title: '预留2',order: 1,view: 'text', type: 'string',},
  reserve3: {title: '预留3',order: 2,view: 'text', type: 'string',},
  reserve4: {title: '预留4',order: 3,view: 'text', type: 'string',},
  reserve5: {title: '预留5',order: 4,view: 'text', type: 'string',},
  afterSalesModel: {title: '机型',order: 5,view: 'text', type: 'string',},
  afterSalesId: {title: '售后者',order: 6,view: 'text', type: 'string',},
  afterSalesDate: {title: '售后时间',order: 7,view: 'date', type: 'string',},
  afterSalesType: {title: '售后类型',order: 8,view: 'text', type: 'string',},
  afterSalesIss: {title: '问题描述',order: 9,view: 'text', type: 'string',},
  afterSalesSolution: {title: '解决方案',order: 10,view: 'umeditor', type: 'string',},
  afterSalesOrderId: {title: '订单ID',order: 11,view: 'text', type: 'string',},
  afterSalesProId: {title: '生产单ID',order: 12,view: 'text', type: 'string',},
  afterSalesImg: {title: '问题照片',order: 13,view: 'image', type: 'string',},
  afterSalesFile: {title: '方案文档',order: 14,view: 'file', type: 'string',},
  remarks: {title: '备注',order: 15,view: 'text', type: 'string',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
